 % Copyright (C) 2012 	Paul Bovbel, paul@bovbel.com
 % 						Richard Abrich, abrichr@gmail.com
 %
 % This file is part our empirical study of boosting algorithms (http://code.google.com/p/boosting-study/)
 % 
 % This is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
 % the Free Software Foundation; either version 3 of the License, or
 % (at your option) any later version.
 % 
 % This source code is distributed in the hope that it will be useful,
 % but WITHOUT ANY WARRANTY; without even the implied warranty of
 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 % GNU General Public License for more details.
 % 
 % You should have received a copy of the GNU General Public License
 % along with this source code. If not, see http://www.gnu.org/licenses/

function [ data ] = splitcont_zero( data, num_intervals )

    F = size(data, 2);
    for i = 2 : F
        feature = data(:, i);% + 1;
        if ~isequal(fix(feature), feature)
            % continuous
            interval = range(feature(feature~=0)) / num_intervals;
            
            haszero = ismember(0, feature);
            
            for k = 1 : num_intervals
                f(feature >= min(feature(feature~=0)) + (k-1) * interval) = k;
                f(feature == 0) = 0;
            end 
            
            data(:,i) = f + haszero;
        end
    end 
end

